﻿/*************************************************************
 * Software of blackcore
 *
 * CLRVersion:4.0.30319.296
 * MachineName:SPACE
 * Author:Andy Huang
 * Email:itblackhole@gmail.com
 * DateTime：6/5/2013 5:22:40 PM
 * Function：
 *************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sob.Machine.WebPageParser.Entity;

namespace Sob.Machine.WebPageParser
{
    public class Config
    {
        #region ******************************Private Property******************************
        #endregion ******************************Private Property******************************


        #region ******************************Public Property******************************
        /// <summary>
        /// 数据初始化是否有效
        /// </summary>
        public bool IsValidate { get; private set; }

        /// <summary>
        /// 出错信息
        /// </summary>
        public string Message { get; private set; }

        /// <summary>
        /// 检索关键词
        /// </summary>
        public List<Keyword> Keywords { get; private set; }

        /// <summary>
        /// 检索域名
        /// </summary>
        public List<Domain> Domains { get; private set; }


        /// <summary>
        /// 检索结果
        /// </summary>
        public List<KeywordResult> KeywordResults { get; private set; }

        /// <summary>
        /// 目标用户k
        /// </summary>
        public List<User> Users { get; private set; }
        #endregion ******************************Public Property******************************


        #region ******************************Structure******************************
        public Config()
        {
            this.IsValidate = false;

            try
            {
                LoadKeywords();
                LoadDomains();
                LoadUsers();
                InitKeywordResults();
            }
            catch (Exception err)
            {
                this.IsValidate = false;
                this.Message = err.Message;
            }

        }


        #endregion  ******************************Structure******************************


        #region ******************************Private Method******************************
        private void LoadKeywords()
        {
            this.Keywords = new List<Keyword>();

            this.Keywords.Add(new Keyword() { SearchKeyword = "挖掘机" });
        }

        private void LoadDomains()
        {
            this.Domains = new List<Domain>();

            this.Domains.Add(new Domain() { Depth = 3, DisplayDomain = "www.d1cm.com", DisplayName = "第一工程机械网", FilterType = new List<FilterFileType>() { FilterFileType.Shtml }, Url = "http://news.d1cm.com/col/1006/scfx/" });
        }

        private void LoadUsers()
        {
            this.Users = new List<User>();
            this.Users.Add(new User() { Name = "", RealName = "黄昊宁", NickName = "blackcore", Email = "itblackhole@qq.com", Mobile = "15001352188", QQ = "50404503" });
        }

        private void InitKeywordResults()
        {
            this.KeywordResults = new List<KeywordResult>();
        }
        #endregion ******************************Private Method******************************


        #region ******************************Public Method******************************
        #endregion ******************************Public Method******************************
    }
}
